package com.stm.bi.report.util;

import com.stm.saas.dto.vo.PolicyDetailVO;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Objects;

/**
 * @author liuyx
 * @date 2025/7/22  16:45
 */
public class DimensionPolicyUtils {

    public static String getPolicyByDimension(String dimension, List<PolicyDetailVO> policyDetailVOS) {
        // todo 兼容旧逻辑的临时处理

        if(CollectionUtils.isEmpty(policyDetailVOS)) {
            return dimension;
        }

        if(Objects.equals(policyDetailVOS.getFirst().getCode(), "online_life_format")) {
            return "format_life";
        }
        if(Objects.equals(policyDetailVOS.getFirst().getCode(), "online_cooperation_format")) {
            return "format_cooperative";
        }
        if(Objects.equals(policyDetailVOS.getFirst().getCode(), "area_format")) {
            return "region_region";
        }
        if(Objects.equals(policyDetailVOS.getFirst().getCode(), "investment_format")) {
            return "format_investment";
        }

        return dimension;
    }
}
